package com.wanxi.service.impl;

import com.wanxi.dao.CuisineDao;
import com.wanxi.dao.impl.CuisineDaoImpl;
import com.wanxi.dto.CuisineDto;
import com.wanxi.model.CuisineModel;
import com.wanxi.service.CuisineService;

import java.util.List;

public class CuisineServiceImpl implements CuisineService {
    private CuisineDao cuisineDao = new CuisineDaoImpl();

    public String add(CuisineModel model) {
        int count = cuisineDao.add(model);
        if (count > 0) {
            return "success";
        } else {
            return "error";
        }
    }

    public String update(CuisineModel model) {
        int count = cuisineDao.update(model);
        if (count > 0) {
            return "success";
        } else {
            return "error";
        }
    }

    public String delete(CuisineModel model) {
        int count = cuisineDao.delete(model);
        if (count > 0) {
            return "success";
        } else {
            return "error";
        }
    }

    public CuisineDto findById(CuisineModel model) {
        return cuisineDao.findById(model);
    }

    public List<CuisineDto> findAll(CuisineModel model) {
        return cuisineDao.findAll(model);
    }

    public int count(CuisineModel model) {
        return cuisineDao.count(model);
    }
}
